package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.Result;
import com.itheima.pojo.Plan;
import com.itheima.service.AdviceService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/advice")
public class AdviceController {

    @Reference
    private AdviceService adviceService;

    @RequestMapping("/findByPhone")
    public Result findByPhone(String phone) {
        try {
            Plan plan = adviceService.findByPhone(phone);
            return new Result(true, "查询成功", plan);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, "暂无健康干预信息");
        }
    }

}
